package com.hsy.linemoney.common;

import com.hsy.linemoney.beans.CountryPair;
import com.hsy.linemoney.beans.LangPair;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/**
 * Created by hsy on 2016/3/23.
 */
public class Config {
    public static final String SHARED_PREFERENCES_NAME = "linemoney_shared_preference";
    public static final String API_SERVER = "http://ny88.org/";

    public static final List<LangPair> availableLang = new ArrayList<>();

    static {
        availableLang.add(new LangPair("中文", Locale.CHINESE));
        availableLang.add(new LangPair("English", Locale.ENGLISH));
    }

    public static final List<CountryPair> availableCountry = new ArrayList<>();

    static {
        availableCountry.add(new CountryPair("中国", Locale.CHINESE));
        availableCountry.add(new CountryPair("America", Locale.ENGLISH));
    }

    private static String[] localLangNameArray = null, localCountryNameArray = null;

    public static String[] getAvailableLangNameArray() {
        if (null == localLangNameArray) {
            localLangNameArray = new String[availableLang.size()];
            for (int i = 0; i < localLangNameArray.length; i++) {
                localLangNameArray[i] = availableLang.get(i).name;
            }
        }
        return localLangNameArray;
    }

    public static String[] getAvailableCountryArray() {
        if (null == localCountryNameArray) {
            localCountryNameArray = new String[availableCountry.size()];
            for (int i = 0; i < localCountryNameArray.length; i++) {
                localCountryNameArray[i] = availableCountry.get(i).name;
            }
        }
        return localCountryNameArray;
    }

    public static LangPair getAvailableLang(int pos) {
        return availableLang.get(pos);
    }

    public static CountryPair getAvailableCountry(int pos) {
        return availableCountry.get(pos);
    }
}
